package com.meilai.project.dto.business.intentionScheme;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @author xchen
 * @since 2022-02-25
 */
@Data
@ApiModel
public class IntentionSchemeSaveDTO {
    @ApiModelProperty(value = "自增列id，非首次提交、保存，必须传入", example = "1")
    private Long id;

    @ApiModelProperty("选择点位的id,第一次保存时为空")
    private Long choose_id;

    @ApiModelProperty("不包含指定sale的chooseId占用的点位")
    private Long exclude_sale_choose_id;

    @NotNull
    @ApiModelProperty("方案名称")
    private String plan_name;

//    @NotNull
    @ApiModelProperty("方案类型")
    private Integer plan_type;

    @ApiModelProperty("关联单据类型：1：合同，2：销售单")
    private Integer related_type;

    @ApiModelProperty("补充协议对应合同ID")
    private Long related_id;

    @NotNull
    @ApiModelProperty("客户id")
    private Long customer_id;

    @ApiModelProperty("销售员id")
    private Long seller_id;

    @ApiModelProperty("备注")
    private String memo;

    @ApiModelProperty("1：普通类型 2：换画类型")
    private Integer type = 1;

    @NotNull
    @ApiModelProperty("分时间段数据列表")
    private List<PointProcessDateRangeDTO> dataList;

    public Integer getMediaPointCount() {
        int count = 0;
        for (PointProcessDateRangeDTO dateRangeDTO : dataList) {
            count = count + dateRangeDTO.getPointList().size();
        }
        return count;
    }
}
